package com.coder4j.log.mapper;

import com.coder4j.starter.mybatis.BaseMapper;
import com.coder4j.log.entity.OperationLogEntity;
import org.apache.ibatis.annotations.Mapper;

import java.util.Arrays;
import java.util.List;

/**
 * 用户操作日志
 *
 * @author keller
 * @date 2024-05-07 18:24:22
 */
@Mapper
public interface OperationLogMapper extends BaseMapper<OperationLogEntity> {
    /**
     * 默认查询条件
     *
     * @return
     */
    @Override
    default List<String> defaultCondition() {
        return Arrays.asList(
				" <if test = 'createId!=null'> AND create_id=#{createId} </if>",
                " <if test = 'updateId!=null'> AND update_id=#{updateId} </if>",
                " <if test = 'isDeleted!=null'> AND is_deleted=#{isDeleted} </if>",
                " <if test = 'name!=null'> AND name=#{name} </if>",
                " <if test = 'ip!=null'> AND ip=#{ip} </if>",
                " <if test = 'address!=null'> AND address=#{address} </if>",
                " <if test = 'browser!=null'> AND browser=#{browser} </if>",
                " <if test = 'os!=null'> AND os=#{os} </if>");
    }
}
